Guild icon
Project Sekai
🔒 UMDCTF 2023 / ✅-rev-welcome-to-python
Avatar
Welcome to Python! - 500 points
Category: Rev Description: Jimmy has a Python program which compiled into something he's never seen. Can you fix it? Author: Assgent Files:Tags: No tags.
Sutx pinned a message to this channel. 04/28/2023 3:00 PM
Avatar
@chenx3n wants to collaborate 🤝
Avatar
ok need 3.10 version of pyinstractor
15:21
i only got 3.9
15:21
zz
Avatar
im reversing bytecode directly
Avatar
i never got lucky finding the good version for decompilation
Avatar
is it hard direct rev
Avatar
dont think so, but could take some time
Avatar
i decompiled it
15:22
nice
15:22
share decompilation pls
Avatar
but i cannot uncomply it
15:22
so i can decompile to pyc
15:22
but Unsupported Python version, 3.10.0, for decompilation
15:23
1.33 KB
Avatar
ah i have .pyc too
Avatar
i thought u decompiled it to .py
Avatar
pycdc should work
15:23
let me check
15:23
i deleted it before
Avatar
im doing pydisasm ./chal.pyc
15:24
to see disassembled bytecode
15:26
goit it
15:26
from math import sqrt, sin, cos from ctypes import c_uint32, c_float from sys import exit as exit_ source = [ 672662614, 741343303, 495239261, 744259788, 722021046, 0xA70AA247L, 1053692, 0xA8050035L, 0xA982A820L, 624689, 0xA90D20BCL, 41134, 295340, 0xA0028102L, 622681, 576469, 671170814, 0x8041086EL, 765, 680595550, 0x80200166L, 698368102, 2437137, 0x8042C1EEL, 570966112, 4612341, 0x800008D4L, 0xA94D02CEL, 16484, 2103301, 136226, 9438506, 663820758, 0x8013523BL, 8405532, 0xA4000875L, 0x80030A78L, 136768] seed = 64 def wandom(x): return x * x * cos(x) * sin(x) / 1000 def evil_bit_hack(y): return int(c_uint32.from_buffer(c_float(y)).value) print('==========================================') print('Professional flag checker service (v 97.2)') print('==========================================') flag = input('Show me the flag: ') lf = len(flag) ls = len(source) l = lf if lf < ls else ls for i in range(seed, seed + l): w = wandom(i) c = ~(~ord(flag[i - seed]) ^ evil_bit_hack(wandom(wandom(w))) & evil_bit_hack(w)) + 1 if source[i - seed] != c: print("Uh oh! We don't think your flag is correct... :(") exit_(1) if lf == ls: print('Your flag is correct!') return None None('Some of your flag is correct...')
15:26
rest is easy i guess
Avatar
niiice
15:26
how did u decompile to .py
Avatar
pycdc
15:26
u gonna finish?
Avatar
yeah ill take care of it
Avatar
@Violin wants to collaborate 🤝
Avatar
running brute force
15:36
should get flag in few mins
Avatar
nice
Avatar
Avatar
chenx3n
used /ctf submit
✅ Well done, challenge solved!
Avatar
cool
Exported 45 message(s)